import productApi from "@/api/declaration/erp/productApi"
import httpRequest from "@/config/axios/httpRequest"
import { ProductModel } from "@/models/erp/ProductModel"





// ERP 产品 API
export const ProductApi = {
  // 查询产品分页
  getProductPage: async (params: any) => {
    return await httpRequest.get(productApi.GetProductPage, { params })
  },

  // 查询产品精简列表
  getProductSimpleList: async () => {
    return await httpRequest.get<ProductModel[]>(productApi.GetProductSimpleList)
  },

  // 查询产品详情
  getProduct: async (id: number) => {
    return await httpRequest.get(productApi.GetProduct, { params: { id } })
  },

  // 新增产品
  createProduct: async (data: ProductModel) => {
    return await httpRequest.post(productApi.CreateProduct, data)
  },

  // 修改产品
  updateProduct: async (data: ProductModel) => {
    return await httpRequest.put(productApi.UpdateProduct, data)
  },

  // 删除产品
  deleteProduct: async (id: number) => {
    return await httpRequest.delete(productApi.DeleteProduct, { params: { id } })
  },

  // 导出产品 Excel
  exportProduct: async (params) => {
    return await httpRequest.download(productApi.ExportProduct, params)
  }
}
